<?php $baseUrl = $this->baseUrl(); ?>
<div class="tit-page">
    <h2>Relatório Semanal</h2>
</div>

<?php if (count($this->rowSetTarefasAtrasadas)) : ?>
<div class="accordion">
    <h3><a href="#">Tarefas Atrasadas (<?php echo count($this->rowSetTarefasAtrasadas); ?>)</a></h3>
    <div>
        <table>
            <thead>
                <tr>
                    <th scope="col">ID</th>
                    <th scope="col">Tarefa</th>
                    <th scope="col">Projeto</th>
                    <th scope="col">Usuário</th>
                    <th scope="col">Dias</th>
                </tr>
            </thead>

            <tbody>
            <?php foreach ($this->rowSetTarefasAtrasadas as $rowTarefaAtrasada) : ?>
                <tr class="tarefa-atrasada">
                    <td>
                        <a href="<?php echo $this->baseUrl(); ?>/tarefa/tarefa/visualizar/id/<?php echo $rowTarefaAtrasada->id_tarefa; ?>">
                        <?php echo $rowTarefaAtrasada->id_tarefa; ?>
                        </a>
                    </td>
                    <td><?php echo $rowTarefaAtrasada->tarefa_st_nome; ?></td>
                    <td><?php echo $rowTarefaAtrasada->projeto_st_nome; ?></td>
                    <td><?php echo $rowTarefaAtrasada->usuario_st_nome; ?></td>
                    <td><?php echo $rowTarefaAtrasada->dias; ?></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div><!-- fim de tarefas atrasadas -->
</div>
<?php endif; ?>
<div class="accordion">
    <h3><a href="#">Tarefas da Semana (<?php echo count($this->rowSetTarefasSemana); ?>)</a></h3>
    <div>
        <table>
            <thead>
                <tr>
                    <th scope="col">ID</th>
                    <th scope="col">Tarefa</th>
                    <th scope="col">Projeto</th>
                    <th scope="col">Usuário</th>
                    <th scope="col">Data Início</th>
                    <th scope="col">Data Fim</th>
                </tr>
            </thead>

            <tbody>

            <?php
            foreach ($this->rowSetTarefasSemana as $rowTarefaSemana) :
                $class = 'tarefa-atrasada';
                if (0 == $rowTarefaSemana->dias) {
                    $class = 'tarefa-alerta';
                }
                if (0 < $rowTarefaSemana->dias) {
                    $class = 'situacao_F';
                }
            ?>
                <tr class="<?php echo $class; ?>">
                    <td>
                        <a href="<?php echo $this->baseUrl(); ?>/tarefa/tarefa/visualizar/id/<?php echo $rowTarefaSemana->id_tarefa; ?>">
                        <?php echo $rowTarefaSemana->id_tarefa; ?>
                        </a>
                    </td>
                    <td><?php echo $rowTarefaSemana->tarefa_st_nome; ?></td>
                    <td><?php echo $rowTarefaSemana->projeto_st_nome; ?></td>
                    <td><?php echo $rowTarefaSemana->usuario_st_nome; ?></td>
                    <td><?php echo $this->dateFormat($rowTarefaSemana->dt_previsao_inicio); ?></td>
                    <td><?php echo $this->dateFormat($rowTarefaSemana->dt_previsao_fim); ?></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div><!-- fim de tarefas da semana -->

</div><!-- fim do accordion -->
